﻿<UserControl x:Class="AnthStat.WPF.Presentation.Controls.CsvExporter"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
             mc:Ignorable="d" 
             d:DesignHeight="200" d:DesignWidth="600">
    <Grid>
        <Border BorderBrush="{StaticResource AccentVeryLightBrush}" BorderThickness="1" Background="White" Padding="15">
            <Grid>
                <Grid.RowDefinitions>
                    <RowDefinition Height="Auto" />
                    <RowDefinition />
                    <RowDefinition Height="Auto" />
                </Grid.RowDefinitions>

                <StackPanel Grid.Row="0" Margin="0, 0, 0, 20">
                    <TextBlock FontWeight="SemiBold" FontSize="24" Text="EXPORT TO CSV"/>
                    <!--<TextBlock FontWeight="Normal" FontSize="12" Foreground="{StaticResource AccentBrush}" Text="Individual Assessments"/>-->
                </StackPanel>

                <StackPanel Grid.Row="1">
                    <TextBlock Grid.Row="0" Grid.Column="0" Style="{StaticResource DemographicsTextBlockStyle}"
                                               Text="File Name" />

                    <Grid>
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition Width="*" />
                            <ColumnDefinition Width="Auto" />
                        </Grid.ColumnDefinitions>

                        <TextBox x:Name="tboxFileName" VerticalContentAlignment="Center" Text="{Binding FileName, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" IsEnabled="False" />
                        <Button x:Name="btnBrowse" Grid.Column="1" Margin="10, 0, 0, 0" Content="Browse" Padding="14, 4, 14, 4" Click="btnBrowse_Click"
                                IsEnabled="{Binding IsExporting, Converter={StaticResource BooleanInverter}}"/>
                    </Grid>

                    <!--<ProgressBar Visibility="{Binding IsExporting, Converter={StaticResource BooleanToVisibilityConverter}, FallbackValue=Collapsed}" IsIndeterminate="True" Foreground="CornflowerBlue" Height="16" Margin="0, 10, 0, 0" />-->
                    <!--<ProgressBar Visibility="{Binding IsExporting, Converter={StaticResource BooleanToCollapsedConverter}, FallbackValue=Visible}" IsIndeterminate="False" Foreground="CornflowerBlue" Height="16" Margin="0, 10, 0, 0" />-->
                    <!--<TextBlock Text="{Binding RecordsExported}" Margin="0, 4, 0, 0" />-->

                </StackPanel>

                <StackPanel Grid.Row="2" Grid.ColumnSpan="3" Orientation="Horizontal" HorizontalAlignment="Right" Margin="0, 30, 0, 0" >
                    <Button Style="{StaticResource DarkButtonStyle}" Width="100" IsEnabled="{Binding FileName, Converter={StaticResource LengthToEnabledConverter}}" Background="{StaticResource AccentLightBrush}" Content="Export"
                            Command="{Binding ExportCommand}" />
                    <StackPanel Width="10" />
                    <Button Style="{StaticResource DarkButtonStyle}" Width="100" IsEnabled="True" Background="{StaticResource AccentLightBrush}" Content="Close"
                            Command="{Binding CloseCsvExporterCommand}"/>
                </StackPanel>
            </Grid>
        </Border>

        <Border Background="#66000000" Padding="20" Visibility="{Binding IsDisplayingResults, Converter={StaticResource BooleanToVisibilityConverter}, FallbackValue=Visible}">
            <Border BorderBrush="{StaticResource AccentVeryLightBrush}" BorderThickness="1" Background="White" Padding="15">
                <Grid>
                    <Grid.RowDefinitions>
                        <RowDefinition Height="Auto" />
                        <RowDefinition />
                        <RowDefinition Height="Auto" />
                    </Grid.RowDefinitions>

                    <StackPanel Grid.Row="0" Margin="0, 0, 0, 20">
                        <TextBlock FontWeight="SemiBold" FontSize="24" Text="EXPORTING"/>
                        <!--<TextBlock FontWeight="Normal" FontSize="12" Foreground="{StaticResource AccentBrush}" Text="Individual Assessments"/>-->
                    </StackPanel>

                    <StackPanel Grid.Row="1" Visibility="{Binding IsExporting, Converter={StaticResource BooleanToCollapsedConverter}, FallbackValue=Visible}" HorizontalAlignment="Left" >
                        <Grid>
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition Width="Auto" />
                                <ColumnDefinition Width="10" />
                                <ColumnDefinition Width="*" />
                            </Grid.ColumnDefinitions>
                            
                            <Ellipse Grid.Column="0" Fill="Green"  Width="24" Height="24" />
                            <Path  Stretch="Fill" Height="14" Width="14" Fill="White" Data="F1 M 23.7501,33.25L 34.8334,44.3333L 52.2499,22.1668L 56.9999,26.9168L 34.8334,53.8333L 19.0001,38L 23.7501,33.25 Z" />
                            
                            <StackPanel Grid.Column="2">
                                <TextBlock Text="{Binding RecordsExported, FallbackValue='...'}" FontWeight="SemiBold" FontSize="14" />
                            </StackPanel>
                        </Grid>
                    </StackPanel>
                    
                    <StackPanel Grid.Row="1" Visibility="{Binding IsExporting, Converter={StaticResource BooleanToVisibilityConverter}, FallbackValue=Collapsed}" >
                        <ProgressBar Minimum="0" Maximum="1" Value="{Binding ExportProgress, Mode=OneWay, FallbackValue=0}" IsIndeterminate="False" Foreground="CornflowerBlue" Height="20" Margin="0, 0, 0, 0" />
                    </StackPanel>

                    <StackPanel Grid.Row="2" Grid.ColumnSpan="3" Orientation="Horizontal" HorizontalAlignment="Right" Margin="0, 30, 0, 0" >
                        <Button Style="{StaticResource DarkButtonStyle}" Width="100" IsEnabled="True" Background="{StaticResource AccentLightBrush}" Content="Close"
                            Command="{Binding CloseCsvExporterCommand}"/>
                    </StackPanel>
                </Grid>
            </Border>
        </Border>
    </Grid>
</UserControl>
